<?php

  //to do: improve the way to pass two or more parameters in the paged-table ( link )
    
  $aux = explode ( '|', $_GET['id'] );
  $index=0;
  $LeaveamountsUid = str_replace ( '"', '', $aux[$index++] );

  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrLeaveAmounts.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrLeaveAmountsPeer::retrieveByPK( $LeaveamountsUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrLeaveAmounts' ) ) { 
     $fields['LEAVEAMOUNTS_UID'] = $tr->getLeaveamountsUid();
     $fields['LABEL_LEAVEAMOUNTS_UID'] = $tr->getLeaveamountsUid();
     $fields['BENEFIT_ID'] = $tr->getBenefitId();
     $fields['LABEL_BENEFIT_ID'] = $tr->getBenefitId();
     $fields['LEAVETYPE'] = $tr->getLeavetype();
     $fields['LABEL_LEAVETYPE'] = $tr->getLeavetype();
     $fields['LEAVEBALANCE'] = $tr->getLeavebalance();
     $fields['LABEL_LEAVEBALANCE'] = $tr->getLeavebalance();
     $fields['LEAVEUNIT'] = $tr->getLeaveunit();
     $fields['LABEL_LEAVEUNIT'] = $tr->getLeaveunit();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrEmployee';
  $G_ID_MENU_SELECTED = 'ID_HR_EMP';
  $G_ID_SUB_MENU_SELECTED = 'ID_HR_LEAVE_AMOUNTS';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrLeaveAmountsDelete', '', $fields, 'hrLeaveAmountsDeleteExec' );
  G::RenderPage('publish', 'blank');   
?>